package lightcar;

import java.awt.Color;
import java.awt.Graphics;

public class LightSource
{
    private Point loc;
    private double intensity;
    
    LightSource()
    {
        intensity = 100;
        loc = new Point(0,0);
    }
    
    LightSource(int x, int y)
    {
        intensity = 100;
        loc = new Point(x,y);
    }
    LightSource(Point p)
    {
        intensity = 100;
        loc = p.clone();
    }
    LightSource(java.awt.Point newPoint)
    {
        intensity=100;
        loc = new Point(newPoint);
    }
    public Point getLocation()
    {
        return loc;
    }
    public double get_intensity(Point p)
    {
        //Gets the intensity caused by this light at point loc
        double dist = World.dist(loc, p);
        if(dist <= 0)
        {
            return intensity;
        }
        else
        {
            return intensity / dist;
        }
    }
    public void draw(Graphics g)
    {
        g.setColor(Color.yellow);
        g.fillOval((int)loc.x-5,(int)loc.y-5,10,10);
    }
}
